#include<bits/stdc++.h>
using namespace std;
const int MAXN = 8e3+5;
int n, q, flag, v, x, lastflag;
struct node{
	int value, last;
}a[MAXN];
bool cmp(node a, node b){
	if (a.value == b.value) return a.last < b.last;
	return a.value < b.value;
	
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin >> n >> q;
	for (int i = 1; i <= n; i ++){
		cin >> a[i].value;
		a[i].last = i;
	}
	for (int i = 1; i <= q; i ++){
		cin >> flag;
		if (flag == 2){
			cin >> x;
			if (lastflag != 2) sort(a+1, a+n+1, cmp);
			for (int j = 1; j <= n; j ++) {
				if (a[j].last == x){
					cout << j << endl;
					break;
				}
			}
		} else if (flag == 1){
			cin >> x >> v;
			for (int j = 1; j <= n; j ++) {
				if (a[j].last == x){
					a[j].value = v;
					break;
				}
			}
		}
		lastflag = flag;
	}
	return 0;
} 
